package com.badibadi.mytools;

import android.app.Activity;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.os.StrictMode;
import android.util.DisplayMetrics;

public class SystemUtils {

	public static float getScreenW(Context context)
	{
		
			DisplayMetrics metrics = new DisplayMetrics();// 获取屏幕宽高
			((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics);// 1。获取窗口管理器，2默认的屏幕，3获取屏幕的大小（赋值给metrcs）
			float ScreenW = metrics.widthPixels;
			float ScreenH = metrics.heightPixels;
			return ScreenW;
	}
	
	/**
	 * 设置严轲模式仅在调试时使用
	 */
		public static void SetStrctMode(Context context)
		{
			ApplicationInfo appInfo = context.getApplicationInfo();  
			int appFlags = appInfo.flags;  
			if ((appFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0) {  
			    // Do StrictMode setup here  
			    StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()  
			        .detectLeakedSqlLiteObjects()  
			        .penaltyLog()  
			        .penaltyDeath()  
			        .build());  
			}  
		}
}
